// See https://sequelize.org/master/manual/model-basics.html
// for more of what you can do here.
const Sequelize = require('sequelize');
const DataTypes = Sequelize.DataTypes;

module.exports = function (app) {
  const sequelizeClient = app.get('sequelizeClient');
  const event = sequelizeClient.define('event', {
    name: {
      type: DataTypes.STRING,
      allowNull: false
    },
    peopleLimit:{
      type: DataTypes.INTEGER,
      allowNull: false,
    },
    startMoney:{
      type: DataTypes.DECIMAL(10,2),
      allowNull: false,
    },
    enrollStime:{
      type: DataTypes.DATE,
      allowNull: false,
    },
    enrollEtime:{
      type: DataTypes.DATE,
      allowNull: false,
    },
    stime:{
      type: DataTypes.DATE,
      allowNull: false,
    },
    etime:{
      type: DataTypes.DATE,
      allowNull: false,
    },
    desc: DataTypes.TEXT,
    jf: { 
      type: DataTypes.TEXT,
      default: 0
    },
    cusForm: DataTypes.TEXT,
    cover:DataTypes.TEXT
    
  }, {
    hooks: {
      beforeCount(options) {
        options.raw = true;
      }
    }
  });

  // eslint-disable-next-line no-unused-vars
  event.associate = function (models) {
    // Define associations here
    // See https://sequelize.org/master/manual/assocs.html
  };

  return event;
};
